package com.guoxin.concurrentcy.chapter3;

import java.util.Arrays;

/**
 * ThreadGroup
 *
 * @author guoxin
 * @date 2019/7/1
 */
public class CreateThread {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });
        t1.start();

        ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
        System.out.println(threadGroup.activeCount());
        Thread[] threads = new Thread[threadGroup.activeCount()];
        threadGroup.enumerate(threads);
        Arrays.asList(threads).forEach(System.out::println);

    }
}
